#include <iostream>
#include "contacts.pb.h"
#include <string>

using std::cout;
using std::endl;
using std::string;

int main()
{
    contacts::contact cont;
    cont.set_sn(100001);
    cont.set_name("张三");
    cont.set_score(89.5);
    // 序列化
    string s = cont.SerializeAsString();
    // 反序列化
    contacts::contact student;
    student.ParseFromString(s);
    cout << "姓名：\t" << student.name() << endl;
    cout << "学号：\t" << student.sn() << endl;
    cout << "成绩：\t" << student.score() << endl;
    return 0;
}